<template>
  <div class="employees-container">
    <div class="app-container">
      <el-card>
        <el-tabs>
          <el-tab-pane label="登录账户设置">
            <AccountSet :user-data="userData" />
          </el-tab-pane>
          <el-tab-pane label="个人详情">
            <AccountDetail :user-data="userData" />
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>

<script>
// 导入 模板
import AccountSet from './components/account-set.vue'
import AccountDetail from './components/account-detail.vue'

// 导入 获取用户信息
import { getUserDetailById } from '@/api/user.js'

export default {
  components: {
    AccountSet,
    AccountDetail
  },
  data () {
    return {
      // 用户的ID
      userId: this.$route.params.id,
      // 用户的信息
      userData: {}
    }
  },
  created () {
    this.xgetUserDetailById()
  },
  methods: {
    // 获取用户信息
    async xgetUserDetailById () {
      const data = await getUserDetailById(this.userId)
      console.log(data)
      this.userData = data
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
